<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/react.development.js"></script>
    <script src="js/react-dom.development.js"></script>
    <script src="js/babel.min.js"></script>
</head>
<body>
    <div id="root"></div>
     <!-- 告知浏览器，此处js代码为非标准js -->
    <script type="text/babel">
        class Helloworld extends React.Component{
            // 生命周期开始后自动执行的方法
            componentDidMount() {
                console.log('====================================');
                console.log('cdm');
                console.log('====================================');
            }
            // 销毁之前执行的方法，需要手动销毁
            componentWillUnmount() {
                console.log('====================================');
                console.log('cwun');
                console.log('====================================');
            }
            render(){
                return(
                    <h1>Hello world!</h1>
                )
            }
        }
            render(){
                return(
                    <h1>hello world</h1>
                );
            }
        }   
        ReactDOM.render(
            <Helloworld />,
            document.getElementById('root')
        )
        setTimeout(()=>{
            ReactDOM.render(<h1>byby</h1>,document.getElementById('root'))
        },3000);
        
    </script>
</body>
</html>